import java.util.Scanner;

import exception.BoundaryException;
import exception.SignalException;
import signal.Signal;
import util.show.View;
import util.vehicle.MarsCar;
import util.vehicle.Vehicle;

public class Main {
	public static void main(String[] args) {

		Vehicle marsCar = new MarsCar("夸父", 5, "蓝色");
		Signal s = new Signal();
		// Signal s = new Signal("wd");
		// marsCar.printPosition();
		// marsCar.doMove(s);
		// marsCar.printPosition();
		// marsCar.doMove(s);
		View view = new View("desc");
		marsCar.setShowStyle(view);
		marsCar.showInit();
		while (true) {
			// marsCar.printPosition();
			Scanner sc = new Scanner(System.in);
			String rawSignal = sc.next();

			if ("stop".equals(rawSignal)) {
				break;
			}

			try {
				s.setDir(rawSignal);
				marsCar.doMove(s);
			} catch (BoundaryException be) {
				System.out.println(be.getMessage());
			} catch (SignalException se) {
				System.out.println(se.getMessage());
			}

		}
		marsCar.showTrace();

	}
}